package com.example.zhucongjdbc;

import java.util.Scanner;

/**
 * @Description:
 * @Author:mayc
 * @Date:2020/3/7 10:19
 */
public class Main3 {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        while (input.hasNext()) {
            String line = input.nextLine();
            String[] zb = line.split(";");
            int x = 0, y = 0;
            for (int i = 0; i < zb.length; i++) {
                String point = zb[i];
                if (point.equals("")) continue;
                if (!point.matches("^(W|S|A|D)\\d{1,2}$")) continue;
                String addres = point.substring(0, 1);
                Integer num = Integer.valueOf(point.substring(1));
                switch (addres) {
                    case "W":
                        y += num;
                        break;
                    case "S":
                        y -= num;
                        break;
                    case "A":
                        x -= num;
                        break;
                    case "D":
                        x += num;
                        break;
                }
            }
            System.out.println(x + "," + y);
        }
    }
}
